<html> 
<head> 
<title> </title>
<style> 
px {font-family: "Lucida Console", Monaco }
p { font-size:100%; line-height:1.1em; }
body {xfont-style: sans-serif}
body {
color:#333; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:1em; line-height:1.3em; }
a:visited { color:#666; }
h1,h2,h3,h4,h5,h6 { color:#333; font-family:georgia, verdana, sans-serif; }
h1 { font-size:150%; page-break-before:auto;background-color: #aaaaff}
h2 { font-size:143%;color:teal; }
h3 { font-size:134%;color:blue; }
h4 { font-size:120%;color:gray; }
img { max-width: 55em}
p{ padding: 0;margin:0; }
p{ padding-right:1.4em; }
p{ padding-bottom:0.1em; }
p{ padding-top:1em; }
p{ whitespace: pre-wrap; }
h5,h6 { font-size:100% }
a.nav,a:link.nav, a:visited.nav { background-color:#FFF; color:#000; }
XXtable { border:double #000; border-collapse:collapse; }
XXtable { border-collapse:collapse; }
XXtd { border:thin solid #888; }
XXtd { border:none; }
li { margin-bottom:0.5em; }
blockquote { display:block; font-size:100%; line-height:1.1em; margin:0 0 0.5em; padding:0 2.5em; }
pre { background-color:#DDD; font-size:100%; overflow:auto; padding:1em; }
a,li span { color:#000; }
a:hover, a.nav:hover, a:hover math { background-color:#000; color:#FFF; }
#Container { margin:0 10px; text-align:center; background-color: #BBB}
#Content { border-top:none; margin:auto; padding:0.3em; text-align:left; width:100%; max-width:55em; background:#FFF}
span.webName { font-size:.5em; }
textarea#content { font-size: 1em; line-height: 1.125; }
h1#pageName { line-height:1em; margin:0.2em 0 0.2em 0; padding:0; }
.property { color:#666; font-size:100%; }
a.existingWikiWord[title]{ //border: 1px dashed #BBB; }
.byline { color:#666; font-size:1.0em; font-style:italic; margin-bottom:1em; padding-top:1px; } 
</style> 
</head>
<BODY bgcolor=#F0F0F0 text=#000000 link=#0000ff vlink=#C000C0 alink=#ff0000><A NAME=top></A>
<h5><a href="https://github.com/urbanjost/M_strings">[UP]</a></h5>
<div id="Container">
<div id="Content">
<CENTER>
<H1><HR><I>Manual Reference Pages &nbsp;-&nbsp;</I><NOBR>getvals (3m_strings)</NOBR><HR></H1>
</CENTER>
<A name=0>

     <H3>NAME</H3>

</A>
<BLOCKQUOTE>
<B>getvals</B>(3f) - [M_strings:NUMERIC] read arbitrary number of REAL values
from a character variable up to size of <B>VALUES</B>() array
(LICENSE:PD)
<P>
</BLOCKQUOTE>
<A name=contents></A><H3>CONTENTS</H3></A>
<BLOCKQUOTE>
<A HREF=#1>Synopsis</A><BR>
<A HREF=#2>Description</A><BR>
<A HREF=#3>Options</A><BR>
<A HREF=#4>Returns</A><BR>
<A HREF=#5>Examples</A><BR>
<A HREF=#6>Author</A><BR>
<A HREF=#7>License</A><BR>
</BLOCKQUOTE>
<A name=8>

     <H3>SYNOPSIS</H3>

</A>
<BLOCKQUOTE>
subroutine <B>getvals</B>(line,values,icount,ierr)
<P>
<PRE>
    character(len=*),intent(in)  :: line
    class(*),intent(out)         :: values(:)
    integer,intent(out)          :: icount
    integer,intent(out),optional :: ierr
<P>
</PRE>
</BLOCKQUOTE>
<A name=2>

     <H3>DESCRIPTION</H3>

</A>
<BLOCKQUOTE>
<B>GETVALS</B>(3f) reads a relatively arbitrary number of numeric values from
a character variable into a REAL array using list-directed input.
<P>
NOTE: In this version null values are skipped instead of meaning to leave
that value unchanged
<BLOCKQUOTE>
<P>
1,,,,,,,2 / reads VALUES=[1.0,2.0]
</BLOCKQUOTE>
<P>
Per list-directed rules when reading values, allowed delimiters are
comma, semi-colon and space.
<P>
the slash separator can be used to add inline comments.
<P>
<PRE>
       10.1, 20.43e-1 ; 11 / THIS IS TREATED AS A COMMENT
<P>
</PRE>
Repeat syntax can be used up to the size of the output array. These are
equivalent input lines:
<P>
<PRE>
       4*10.0
       10.0, 10.0, 10.0, 10.0
<P>
</PRE>
</BLOCKQUOTE>
<A name=3>

     <H3>OPTIONS</H3>

</A>
<BLOCKQUOTE>
<TABLE cellpadding=3>
<TR valign=top><TD width=6% nowrap>
<B>LINE</B> </TD><TD valign=bottom>
A character variable containing the characters representing
a list of numbers
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=4>

     <H3>RETURNS</H3>

</A>
<BLOCKQUOTE>
<TABLE cellpadding=3>
<TR valign=top><TD colspan=2>
<B></B><B>VALUES</B>() </TD></TR><TR valign=top><TD width=6%>&nbsp;</TD><TD>
array holding numbers read from string. May be of type
INTEGER, REAL, DOUBLEPRECISION, or CHARACTER. If CHARACTER the
strings are returned as simple words instead of numeric values.
</TD></TR>
<TR valign=top><TD width=6% nowrap>
<B>ICOUNT</B> </TD><TD valign=bottom>
number of defined numbers in <B>VALUES</B>(). If ICOUNT reaches
the size of the <B>VALUES</B>() array parsing stops.
</TD></TR>
<TR valign=top><TD width=6% nowrap>
<B>IERR</B> </TD><TD valign=bottom>
zero if no error occurred in reading numbers. Optional.
If not present and an error occurs the program is terminated.
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=5>

     <H3>EXAMPLES</H3>

</A>
<BLOCKQUOTE>
Sample program:
<P>
<PRE>
      program demo_getvals
      use M_strings, only: getvals
      implicit none
      integer,parameter  :: longest_line=256
      character(len=longest_line) :: line
      real               :: values(longest_line/2+1)
      integer            :: ios,icount,ierr
      INFINITE: do
         read(*,&#146;(a)&#146;,iostat=ios) line
         if(ios.ne.0)exit INFINITE
         call getvals(line,values,icount,ierr)
         write(*,&#146;(4(g0,1x))&#146;)&#146;VALUES=&#146;,values(:icount)
      enddo INFINITE
      end program demo_getvals
<P>
</PRE>
</BLOCKQUOTE>
Sample input lines
<P>
<PRE>
       10,20 30.4
       1 2 3
       1
<P>
       3 4*2.5 8
       32.3333 / comment 1
       30e3;300,    30.0, 3
       even 1 like this! 10
       11,,,,22,,,,33
<P>
</PRE>
<BLOCKQUOTE>
Expected output:
<P>
<PRE>
    VALUES=   10.0000000       20.0000000       30.3999996
    VALUES=   1.00000000       2.00000000       3.00000000
    VALUES=   1.00000000
    VALUES=
    VALUES=   3.00000000       2.50000000       2.50000000
    2.50000000       2.50000000       8.00000000
    VALUES=   32.3333015
    VALUES=   30000.0000       300.000000       30.0000000
    3.00000000
    *getvals* WARNING:[even] is not a number
    *getvals* WARNING:[like] is not a number
    *getvals* WARNING:[this!] is not a number
    VALUES=   1.00000000       10.0000000
    VALUES=   11.0000000       22.0000000       33.0000000
<P>
</PRE>
</BLOCKQUOTE>
<A name=6>

     <H3>AUTHOR</H3>

</A>
<BLOCKQUOTE>
John S. Urban
</BLOCKQUOTE>
<A name=7>

     <H3>LICENSE</H3>

</A>
<BLOCKQUOTE>
Public Domain
</BLOCKQUOTE>
<P><HR>
<TABLE width=100%><TR> <TD width=33%><I>Nemo Release 3.1</I></TD> <TD width=33% align=center>getvals (3m_strings)</TD> <TD align=right width=33%><I>April 30, 2022</I></TD> </TR></TABLE><FONT SIZE=-1>Generated by <A HREF="http://www.squarebox.co.uk/download/manServer.shtml">manServer 1.08</A> from 82e15f4a-56cb-42d3-825d-9118ef82a8b4 using man macros.</FONT>
<br><br><center><img src="images/getvals.gif"></center>
</div>
</div>
</body>
</HTML>
